import { request } from '@/utils/request.js'

/**
 * 客户流水 API JS
 */

export default {

  /**
   * 获取客户流水分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'finance/customerBill/index',
      method: 'get',
      params
    })
  },
    /**
   * 获取客户流水--应收分页列表  按客户分组
   * @returns
   */
    getFeeList (params = {}) {
      return request({
        url: 'finance/customerFee/feeList',
        method: 'get',
        params
      })
    },

  /**
   * 添加客户流水
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'finance/customerBill/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新客户流水数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'finance/customerBill/update/' + id,
      method: 'put',
      data
    })
  },
  
  /**
   * 读取客户流水
   * @returns
   */
  read (id, data = {}) {
    return request({
      url: 'finance/customerBill/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 更改客户流水数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'finance/customerBill/changeStatus',
      method: 'put',
      data
    })
  },

  /**
   * 将客户流水删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'finance/customerBill/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取客户流水数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'finance/customerBill/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复客户流水数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'finance/customerBill/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除客户流水
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'finance/customerBill/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 客户流水导出
   * @returns
   */
  exportExcel (params = {}) {
    return request({
      url: 'finance/customerBill/export',
      method: 'post',
      responseType: 'blob',
      params
    })
  },
  //导出模板
  // exportTemplate (data = {},timeout=10000) {
  //   return request({
  //     url: 'finance/customerBill/exportTemplate',
  //     method: 'post',
  //     responseType: 'blob',
  //     timeout:timeout,
  //     data
  //   })
  // },

  /**
   * 获取核销记录
   * @returns
   */
  getStateList (data = {}) {
    return request({
      url: 'finance/statementFee/remote',
      method: 'post',
      data
    })
  },
  /**
   * 反核销
   * @returns
   */
  writeOffRefuse (data = {}) {
    return request({
      url: 'finance/customerBill/writeOff/refuse',
      method: 'post',
      data
    })
  },
  /**
   * 核销
   * @returns
   */
  writeOffPass (data = {}) {
    return request({
      url: 'finance/customerBill/writeOff/pass',
      method: 'post',
      data
    })
  },
  /**
   * 审计
   * @returns
   */
  auditPass (data = {}) {
    return request({
      url: 'finance/customerBill/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuse (data = {}) {
    return request({
      url: 'finance/customerBill/audit/refuse',
      method: 'post',
      data
    })
  },
  writeOffAll (data = {}) {
    return request({
      url: 'finance/customerBill/writeOffAll',
      method: 'post',
      data
    })
  },


}